package API.DAY10.map;

import java.util.*;

public class MapDemo2 {
    public static void main(String[] args) {
        Map<String,Integer> map = new HashMap<>();
        map.put("张三", 90);
        map.put("李四", 80);
        map.put("王五", 70);
        map.put("赵六", 60);
        map.put("田七", 59);
        System.out.println(map);

        Set<String> KeySet = map.keySet();
        for(String key:KeySet){
            System.out.println("key:"+key);
        }

        Set<Map.Entry<String,Integer>> entrySet = map.entrySet();
        for (Map.Entry<String,Integer> e : entrySet){
            String key = e.getKey();
            Integer value = e.getValue();
            System.out.println(key+":"+value);
        }

        Collection<Integer> values = map.values();
        for(Integer value:values){
            System.out.println("value:"+value);
        }

//        values.forEach(e-> System.out.println(e));
        values.forEach(System.out::println);

        map.forEach((k,v)->System.out.println(k +":"+v));
    }
}
